<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AlbumArticleAdd extends FormRequest
{
    private $userId = null;
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        $this->userId = auth('api')->user()->id;
        return $this->userId;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'album_id'=>'bail|required',
            'group_id'=>'bail|required',
            'images' => 'bail|required|string',
            'content' => 'bail|required|string|max:280'
        ];
    }

    public function messages()
    {
        return [
            'album_id.required' => '专辑名称不能为空',
            'group_id.required' => '圈子名称不能为空',
            'images.required' => '至少上传一张图片',
            'content.required' => '文本内容不能为空',
            'content.max' => '文本内容最多140个字',
        ];
    }
}
